package com.gasq.community.message.kafka.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * 客户统一的自定义默认配置
 * Created by mjh on 16/12/19.
 */
@Configuration
public class CustomDefaultSenderConfig {
    /**
     * kafka broker主机配置：ip和端口，
     * 多个以逗号分开
     */
    @Value("${kafka.client.sender.default.bootstrap.servers:}")
    String bootstrapServers;

    /**
     * 客户端id，一般指应用名或业务名
     */
    @Value("${kafka.client.sender.default.client.id:}")
    String clientId;

    /**
     * acks
     */
    @Value("${kafka.client.sender.default.acks:}")
    String acks;

    /**
     * 是否失败重试：0不重试，大于0会重试
     */
    @Value("${kafka.client.sender.default.retries:}")
    Integer retries;

    /**
     * 批处理消息大小（单位：字节）：缓冲超出此值就把消息发送到服务器
     */
    @Value("${kafka.client.sender.default.batch.size:}")
    Integer batchSize;

    /**
     * 批处理时间间隔（单位：毫秒）：缓冲时间超过此值就把消息发送到服务器
     */
    @Value("${kafka.client.sender.default.linger.ms:}")
    Long lingerMs;

    /**
     * 请求超时时间
     */
    @Value("${kafka.client.sender.default.request.timeout.ms:}")
    Integer requestTimeoutMs;

    /**
     * 当前生产者使用的最大内存数量（单位：字节）
     */
    @Value("${kafka.client.sender.default.buffer.memory:}")
    Long bufferMemory;

    @Value("${kafka.client.sender.default.key.serialize:}")
    String keySerialize;

    @Value("${kafka.client.sender.default.value.serializer:}")
    String valueSerializer;

    public String getBootstrapServers() {
        return bootstrapServers;
    }

    public void setBootstrapServers(String bootstrapServers) {
        this.bootstrapServers = bootstrapServers;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getAcks() {
        return acks;
    }

    public void setAcks(String acks) {
        this.acks = acks;
    }

    public Integer getRetries() {
        return retries;
    }

    public void setRetries(Integer retries) {
        this.retries = retries;
    }

    public Long getLingerMs() {
        return lingerMs;
    }

    public void setLingerMs(Long lingerMs) {
        this.lingerMs = lingerMs;
    }

    public Long getBufferMemory() {
        return bufferMemory;
    }

    public void setBufferMemory(Long bufferMemory) {
        this.bufferMemory = bufferMemory;
    }

    public String getKeySerialize() {
        return keySerialize;
    }

    public void setKeySerialize(String keySerialize) {
        this.keySerialize = keySerialize;
    }

    public String getValueSerializer() {
        return valueSerializer;
    }

    public void setValueSerializer(String valueSerializer) {
        this.valueSerializer = valueSerializer;
    }

    public Integer getBatchSize() {
        return batchSize;
    }

    public void setBatchSize(Integer batchSize) {
        this.batchSize = batchSize;
    }

    public Integer getRequestTimeoutMs() {
        return requestTimeoutMs;
    }

    public void setRequestTimeoutMs(Integer requestTimeoutMs) {
        this.requestTimeoutMs = requestTimeoutMs;
    }
}

